﻿@model ProductViewModel

@Html.DevExpress().HtmlEditor(
settings =>
{
    settings.Name = "DesciptionDetail";
    settings.CallbackRouteValues = new { Controller = "Product", Action = "DesciptionDetailPartial" };
    settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
    settings.Height = 200;
    settings.SettingsImageUpload.UploadCallbackRouteValues = new { Controller = "Features", Action = "ContextMenuImageUpload" };
    //settings.SettingsImageUpload.UploadImageFolder = HtmlEditorFeaturesDemosHelper.UploadDirectory;
    //settings.SettingsImageUpload.ValidationSettings.Assign(HtmlEditorFeaturesDemosHelper.ImageUploadValidationSettings);
    if (Model != null)
    {
        if (Model.ProductID.HasValue)
        {
            settings.Html = Model.DescriptionDetail;
        }
        else {
            string htmlContentPath = HttpContext.Current.Server.MapPath("~/Content/HtmlEditor/ContextMenu.htm");
            settings.Html = System.IO.File.ReadAllText(htmlContentPath);
        }
    }
    settings.SettingsImageSelector.Enabled = true;

    settings.Toolbars.Add("Toolbar",
        new ToolbarUndoButton(true),
        new ToolbarRedoButton(),
        new ToolbarBoldButton(true),
        new ToolbarItalicButton(),
        new ToolbarUnderlineButton(),
        new ToolbarStrikethroughButton(),
        new ToolbarInsertLinkDialogButton(true),
        new ToolbarUnlinkButton(),
        new ToolbarInsertImageDialogButton(),
        new ToolbarTableOperationsDropDownButton(true),
        new ToolbarFullscreenButton(true)
    ).CreateDefaultItems();

    settings.Settings.AllowContextMenu = DefaultBoolean.True;
    //settings.ContextMenuItems.Assign((HtmlEditorContextMenuItemCollection)ViewData["ContextMenuItems"]);
    //settings.ClientSideEvents.ContextMenuShowing = "OnContextMenuShowing";
    //settings.ClientSideEvents.CustomCommand = "OnCustomCommand";
}).GetHtml()
